package com.atguigu.java.ai.langchain4j.tools;

import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import dev.langchain4j.agent.tool.ToolMemoryId;
import org.springframework.stereotype.Component;

@Component
public class CalculatorTools {

    @Tool(name = "sum", value = "计算给定两个数字的和并返回结果")
    double sum(
            @ToolMemoryId Long memoryId,
            @P(value = "加数1",required = true) double a,
            @P(value = "加数2",required = true) double b){
        return a + b;
    }

    @Tool("计算给定数字的平方根并返回结果")
    double squareRoot(
            @ToolMemoryId
            double x){
        return Math.sqrt(x);
    }
}
